Install Ruby 2.2
2015/04/06 |
The version of Ruby in CentOS 6 repository is 1.8 but Install 2.2 with RPM package if you need.
|
|
[1] | It's possible to install from CentOS SCLo Software Collections. It's OK to install it even if 1.8 is already installed because 2.2 is located on another PATH. |
# install from SCLo [root@dlp ~]# yum --enablerepo=centos-sclo-rh -y install rh-ruby22
|
[2] | Packages from Software Collections are installed uder the /opt directory. To use it, Load environment variables like follows. |
# load environment variables [root@dlp ~]# scl enable rh-ruby22 bash
[root@dlp ~]#
[root@dlp ~]# ruby -v ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux-gnu] which ruby /opt/rh/rh-ruby22/root/usr/bin/ruby |
[3] | If you'd like to enable Ruby 2.2 automatically at login time, configure like follows. |
[root@dlp ~]#
vi /etc/profile.d/rh-ruby22.sh # create new #!/bin/bash source /opt/rh/rh-ruby22/enable export X_SCLS="`scl enable rh-ruby22 'echo $X_SCLS'`" export PATH=$PATH:/opt/rh/rh-ruby22/root/usr/local/bin |